#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

int main()
{
    string n = "";
    int j = 0;
    cin >> n;
    vector<char> sc;
    for(int i = 0; i < n.size(); i++){
        if(n[i] == '(' || n[i] == '[' || n[i] == '{' || n[i] == '<'){
                sc.push_back(n[i]);
        }
    else if (n[i] == ')'){
        if (sc.size() != 0){
            char b = sc[sc.size() - 1];
            sc.pop_back();
            if (b != '('){
                    j = 1;
                    cout << "False" << endl;
                    break;
                }
            else{
                continue;
            }
        }
        else{
            j = 1;
            cout << "False" << endl;
            break;
        }
   }
    else if (n[i] == ']'){
            if (sc.size() != 0){
                char b = sc[sc.size() - 1];
                sc.pop_back();
                if (b != '['){
                        j = 1;
                        cout << "False" << endl;
                        break;
                    }
                else{
                    continue;
                }
            }
            else{
                j = 1;
                cout << "False" << endl;
                break;
            }
       }
       else if (n[i] == '}'){
            if (sc.size() != 0){
                char b = sc[sc.size() - 1];
                sc.pop_back();
                if (b != '{'){
                        j = 1;
                        cout << "False" << endl;
                        break;
                    }
                else{
                    continue;
                }
            }
            else{
                j = 1;
                cout << "False" << endl;
                break;
            }
       }
       else if (n[i] == '>'){
            if (sc.size() != 0){
                char b = sc[sc.size() - 1];
                sc.pop_back();
                if (b != '<'){
                        j = 1;
                        cout << "False" << endl;
                        break;
                    }
                else{
                    continue;
                }
            }
            else{
                j = 1;
                cout << "False" << endl;
                break;
            }
       }
       else if (n[i] == ' '){
            continue;
       }
    }
    if (sc.size() > 0){
        if (j == 0){
            cout << "False" << endl;
            j = 1;
        }
    }
    if (j == 0){
        cout << "True" << endl;
    }
    }
